{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Introduction\n",
    "-----\n",
    "You (an electrical engineer) wish to determine the resistance of an electrical component by using Ohm's law. You remember from your high school circuit classes that $$V = RI$$ where $V$ is the voltage in volts, $R$ is resistance in ohms, and $I$ is electrical current in amperes. Using a multimeter, you collect the following data:\n",
    "\n",
    "| Current (A) | Voltage (V) |\n",
    "|-------------|-------------|\n",
    "| 0.2         | 1.23        |\n",
    "| 0.3         | 1.38        |\n",
    "| 0.4         | 2.06        |\n",
    "| 0.5         | 2.47        |\n",
    "| 0.6         | 3.17        |\n",
    "\n",
    "Your goal is to \n",
    "1. Fit a line through the origin (i.e., determine the parameter $R$ for $y = Rx$) to this data by using the method of least squares. You may assume that all measurements are of equal importance. \n",
    "2. Consider what the best estimate of the resistance is, in ohms, for this component.\n",
    "\n",
    "## Getting Started\n",
    "----\n",
    "\n",
    "First we will import the neccesary Python modules and load the current and voltage measurements into numpy arrays:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from numpy.linalg import inv\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "# Store the voltage and current data as column vectors.\n",
    "I = np.mat([0.2, 0.3, 0.4, 0.5, 0.6]).T\n",
    "V = np.mat([1.23, 1.38, 2.06, 2.47, 3.17]).T"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we can plot the measurements - can you see the linear relationship between current and voltage?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEKCAYAAAAB0GKPAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAH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5tJHvQ3WD28trTtUcMWP9ijeXDgPdGRF91h7yAvFTVtI/iv3991Z+dP15/OrAy398Esieb9heMI/JtzErhMQwbr+4FXifpT/obJL1b0jnAk2RHCa/Lr0T6g2Hs9x7giqp97neqaYDdZKeo9hPZlMBNkvqLxjzghoiYlr8mA+2STsjXv53sUddmpXDBsHEpf2T2RcC5+WW1G4EbgJ0R8RTwQ7LHR/8AWDeMXX8G6JD0qKTHgU8WxPEc8AtJjw0x6H0Pr87uOJfsyq5qS3l1oLuLbGpcs1L48eZmDUzSTOC/RcQlBf1eB9wHnB0Re0clOBt3fIRh1sAiYh3ws4H3fAxiKnC1i4WVyUcYZmaWxEcYZmaWxAXDzMySuGCYmVkSFwwzM0vigmFmZkn+P05dwFYPqJIjAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(np.asarray(I), np.asarray(V))\n",
    "\n",
    "plt.xlabel('Current (A)')\n",
    "plt.ylabel('Voltage (V)')\n",
    "plt.grid(True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Estimating the Slope Parameter\n",
    "----\n",
    "Let's try to estimate the slope parameter $R$ (i.e., the resistance) using the least squares formulation from Module 1, Lesson 1 - \"The Squared Error Criterion and the Method of Least Squares\":\n",
    "\n",
    "\\begin{align}\n",
    "\\hat{R} = \\left(\\mathbf{H}^T\\mathbf{H}\\right)^{-1}\\mathbf{H}^T\\mathbf{y}\n",
    "\\end{align}\n",
    "\n",
    "If we know that we're looking for the slope parameter $R$, how do we define the matrix $\\mathbf{H}$ and vector $\\mathbf{y}$?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The slope parameter (i.e., resistance) for the best-fit line is:\n",
      "5.134444444444445\n"
     ]
    }
   ],
   "source": [
    "# Define the H matrix, what does it contain?\n",
    "H = I\n",
    "y = V\n",
    "# Now estimate the resistance parameter.\n",
    "R = np.dot(np.dot(np.linalg.inv(np.dot(H.T, H)), H.T), y)\n",
    "R = np.asscalar(R)\n",
    "\n",
    "print('The slope parameter (i.e., resistance) for the best-fit line is:')\n",
    "print(R)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plotting the Results\n",
    "----\n",
    "Now let's plot our result. How do we relate our linear parameter fit to the resistance value in ohms?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(8,)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl4VPX5/vH3wx4I+xIggGFHNoWwuAtWq6JWcalSv2rVlmq1dpPFXWutC9W21ipqay3Vn7QFREUEN0BcqAJiwhZAFiEgO4FAAlme3x8zpmkakiHJZOYk9+u65sqccz5ncjMk8+RszzF3R0REBKBOrAOIiEj8UFEQEZEiKgoiIlJERUFERIqoKIiISBEVBRERKaKiICIiRVQURESkiIqCiIgUqRfrAMeqTZs2npKSUqF1Dx48SJMmTao2UBQFKW+QskKw8gYpKwQrb5CyQuXyLlmyZJe7ty13oLsH6pGamuoVNW/evAqvGwtByhukrO7ByhukrO7ByhukrO6Vywss9gg+Y7X7SEREiqgoiIhIERUFEREpoqIgIiJFVBRERKSIioKIiBRRURARkSIqCiI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ddrHD4uUJYDQNOjLFtFqIU34YPYVwAD3T3F3VPC2YoXoF6E2jqLRIWKgtRo7r4CeAhYYGZfAE+EFz0PnGlmnwLD+d+tg6O93k7g+8ArZpZGqEj0KWe1N4DRpR1oBj4ABoW3Vs4AMt09s8TyvmbWwczqEyogiyPJKlIRap0tEmNm9gfgDXd/t5xxo4HB7n5P9SST2khbCiKx9xtCd/sqTz3g8ShnkVpOWwoiIlJEWwoiIlJERUFERIqoKIiISBEVBRERKaKiICIiRf4/vPmjDCRUNxQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "I_line = np.arange(0, 0.8, 0.1)\n",
    "V_line = R*I_line\n",
    "\n",
    "plt.scatter(np.asarray(I), np.asarray(V))\n",
    "plt.plot(I_line, V_line)\n",
    "plt.xlabel('current (A)')\n",
    "plt.ylabel('voltage (V)')\n",
    "plt.grid(True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If you have implemented the estimation steps correctly, the slope parameter $\\hat{R}$ should be close to the actual resistance value of $R = 5~\\Omega$. However, the estimated value will not match the true resistance value exactly, since we have only a limited number of noisy measurements."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
